<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('平台客户档案列表')" />
    <style>
        .changeColor{
            background-color: #23c6c8  !important;
            color: white;
        }
    </style>
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>手机号：</label>
                                <input type="text" name="userPhone"/>
                            </li>
                            <li>
                                <label>微信昵称：</label>
                                <input type="text" name="userNickname"/>
                            </li>
                            <li>
                                <label>用户类型：</label>
                                <select name="userType" th:with="type=${@dict.getType('user_type')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li class="select-time">
                                <label>加入时间：</label>
                                <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginCreateTime]"/>
                                <span>-</span>
                                <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endCreateTime]"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="col-sm-12 select-table table-bordered">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('zsyh:platformUser:edit')}]];
        var removeFlag = [[${@permission.hasPermi('zsyh:platformUser:remove')}]];
        var userTypeDatas = [[${@dict.getType('user_type')}]];
        var prefix = ctx + "zsyh/platformUser";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                showSearch: false,
                showRefresh: false,
                showToggle: false,
                showColumns: false,
                modalName: "平台客户档案",
                columns: [{
                    field : 'Number',
                    title : '序号',
                    align: 'center',
                    width: 20,
                    formatter : function(value, row, index) {
                        var pageSize = $('#bootstrap-table').bootstrapTable('getOptions').pageSize;//通过表的#id 可以得到每页多少条
                        var pageNumber = $('#bootstrap-table').bootstrapTable('getOptions').pageNumber;//通过表的#id 可以得到当前第几页
                        return pageSize * (pageNumber - 1) + index + 1;//返回每条的序号： 每页条数 * （当前页 - 1 ）+ 序号
                    }
                },
                {
                    field: 'id',
                    title: '主键',
                    align: 'center',
                    visible: false
                },
                {
                    field: 'userPhone',
                    align: 'center',
                    title: '绑定手机号'
                },
                {
                    field: 'userNickname',
                    align: 'center',
                    title: '微信昵称'
                },
                {
                    field: 'userWximage',
                    align: 'center',
                    title: '微信头像',
                    formatter: function (value, row, index) {
                        return $.table.imageView(value);
                    }
                },
                {
                    field: 'userType',
                    align: 'center',
                    title: '用户类型',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(userTypeDatas, value);
                    }
                }],onDblClickRow: function (row) {
                    parent.$('#userNickname').val(row.userNickname);
                    parent.$('#userId').val(row.id);
                    $.modal.close();
                },
                onClickRow:function (row,$element) {
                    $('.changeColor').removeClass('changeColor');//移除class
                    $($element).addClass('changeColor');//添加class
                }
            };
            $.table.init(options);
        });
    </script>
</body>
</html>